<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" isELIgnored="false"%>
<html>
<head>
<script>
function enviar(){
	document.forms[0].target = "blank";
    document.forms[0].submit();
}
</script>
</head>

<body>
<logic:messagesPresent message="true"> 
 <table title="Mensajes de aplicacion" align="center" >
  <tr>
    <td><html:messages id="msg" property="msgInfor" message="true">
      <table border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td bgcolor="#A8BDDD" class="titalert"></td>
         <td bgcolor="#A8BDDD" class="titalert" height="30"><bean:write name="msg"/></td>
       </tr>
      </table></html:messages> 
    </td>
  </tr>
 </table>
 
  <table title="Mensajes de aplicacion" align="center" >
  <tr>
    <td><html:messages id="msg" property="msgError" message="true">
      <table border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td bgcolor="#A8BDDD" class="titalert"></td>
         <td bgcolor="#A8BDDD" class="titalert" height="30"><bean:write name="msg"/></td>
       </tr>
      </table></html:messages> 
    </td>
  </tr>
 </table>
 
 <table title="Mensajes de aplicacion" align="center" >
  <tr>
    <td><html:messages id="msg" property="msgWarn" message="true">
      <table border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td bgcolor="#A8BDDD" class="titalert"></td>
         <td bgcolor="#A8BDDD" class="titalert" height="30"><bean:write name="msg"/></td>
       </tr>
      </table></html:messages> 
    </td>
  </tr>
 </table>
 
 <table title="Mensajes de aplicacion" align="center" >
  <tr>
    <td>    
	    <html:messages id="msg" property="msgOk" message="true">
	      <table border="0" cellpadding="0" cellspacing="0">
	       <tr>
	         <td bgcolor="#A8BDDD" class="titalert"></td>
	         <td bgcolor="#A8BDDD" class="titalert" height="30"><bean:write name="msg"/></td>
	       </tr>
	      </table>
	    </html:messages> 
    </td>
  </tr>
 </table>
</logic:messagesPresent> 
 
<table width="99%"  border="0" cellpadding="0" cellspacing="0" widtd="100%">
 
  <tr> 
    <td height="25" colspan="12" align="center" class="titulosenblanco">
      <P>
        <strong>CRITERIOS DE BUSQUEDA DE USUARIOS</strong>
      </P>
      <P></P>
    </td>  
  </tr>
  
  <tr align="left"> 
     <td height="25" colspan="12" class="titulosenblanco">
     	<div align="center">
			<table width="40%" border="0" cellpadding="0" cellspacing="0">
		    	<tr> 
		        	<td align="center">
		        		<html:link page="/admin/newUser.do">
		        			<img src="<%= request.getContextPath() + "/images/b_nuevo.gif" %>" alt="Nuevo" width="22" height="22" border="0"><br>
		            		<span class="celdaayd">Nuevo Usuario</span>
		            	</html:link>
		           	</td>
		            <td align="center">
		            	<html:link page="/User/SearchPermissionsReport.do">
		            		<img src="<%= request.getContextPath() + "/images/ver1.gif" %>" alt="Nuevo" width="22" height="22" border="0"><br>
		              		<span class="celdaayd">Consultar Permisos</span>
		              	</html:link>
		            </td>
		            <td align="center">
		            	<html:link page="/User/PermissionsReport.do">
		            		<img src="<%= request.getContextPath() + "/images/b_nuevo.gif" %>" alt="Nuevo" width="22" height="22" border="0"><br>
		              		<span class="celdaayd">Permisos Reportes</span>
		              	</html:link>
		            </td>
		            
		        </tr>
		        <tr> 
		           <td></td>
		        </tr>  
		    </table>
      	</div>
      </td>		
  </tr>

  
  
<html:form action="/admin/manageUsers.do" focus="name" method="get">     
	<input type="hidden" name="search" value="search">
  	<tr align="left">
    <td width="100%" align="center"> 
		<table width="70%" border="0" cellpadding="3" cellspacing="3">
        <tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%" align="left" class="celdatabla"><strong>Usuario</strong> 
            </td>
          <td width="61%"><html:text size= "40" styleClass="form" property="name" maxlength="40" value=""/></td>
          <td width="10%">&nbsp;</td>
        </tr>
        <!--<tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%" align="left" class="celdatabla"><strong>Vigencia</strong> 
            </td>
          <td width="61%">
              <select name="use" class="form">
                  <option value="">Seleccionar vigencia</option>  
                  <option value="s">si</option>
                  <option value="n">no</option>
              </select> 
          </td>
          <td width="10%">&nbsp;</td>
        </tr>-->
				
        <tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%" align="left" class="celdatabla"><strong>Grupo de usuario</strong> 
            </td>
          <td width="61%">
              <html:select styleClass="form" property="userGroupCode" style="width:215" >
                <html:option value="">Seleccione un Grupo</html:option>
                <html:options collection="userGroups" property="code" labelProperty="name" /> 
              </html:select>
          </td>
          <td width="10%">&nbsp;</td>
        </tr>
        
         <%--<tr>
          <td align="left" class="celdatabla"><strong>Escoja la Secretaria</strong></td>
          <td align="left">
            <logic:iterate id="areas" name="ListaAllAreas" length="1" type="co.gov.medellin.ssti.sub.model.vo.AreaVO">
              <html:select name="areas"  property="code" styleClass="form">
                <html:options name="ListaAllAreas" labelName="AreaPadre" labelProperty="nombre" property="code" collection="ListaAllAreas"/>
              </html:select>
            </logic:iterate>
          </td>   
        </tr>
        ******************* --%>
        <tr>
        <td width="7%">&nbsp;</td>
        <td width="22%" align="left" class="celdatabla"><strong>Secretarias:</strong> 
            </td>
    <td width="61%">
      <logic:notPresent name="areas">
        <DIV align="center">
          <%= session.getAttribute("msg")%>
           <%session.removeAttribute("msg");%>
        </DIV>
      </logic:notPresent>
       <%   Object codeArea = request.getParameter("code"); 
            if(codeArea==null) codeArea = "nulo";
       %>
        <div align="left">
          <logic:present name="areas">
            <logic:iterate id="area" name="areas" length="1" type="co.gov.medellin.ssti.sub.model.vo.AreaVO">
              <html:select name="area" property="code" title="Area" styleClass="form" value="<%=(String)codeArea%>">
              <option value="" selected="selected">Seleccione una secretaria</option>
                <html:options name="area" labelName="codeArea" labelProperty="nombre" property="code" collection="areas"/>
              </html:select>
            </logic:iterate>
          </logic:present>
        </div>
    </td>

        <tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%">&nbsp;</td>
          <td width="61%"><input type="submit" name="Submit" value="Buscar" > </td>
          <td width="10%">&nbsp;</td>
        </tr>
        <tr> 
          <td colspan="4">&nbsp;</td>
        </tr>
        <tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%">&nbsp;</td>
          <td width="61%">&nbsp;</td>
          <td width="10%">&nbsp;</td>
        </tr>
      </table>
	</td>
  </tr>
</html:form> 	
  
  
  
  <tr>
    <td colspan="12" align="left">
      <logic:present name="msg">
        <% if(request.getAttribute("msg") != null){ %>
          <div align="center"><%=request.getAttribute("msg")%></div>
        <%}%>
      </logic:present>
    </td>
  </tr>
  <tr> 
    <td colspan="12" align="left">
      <bean:define id="user"  scope="session" name="userInfo" type="co.gov.medellin.ssti.sub.paoyer.administration.model.vo.UserVO"/>
      <div align="center">		
      <logic:present name="userList"> 
        <display:table name="requestScope.userList" class="bordesTable"  id="users" export="false" pagesize="50" cellpadding="3" cellspacing="1" style="width:100%">
                <bean:define id="vigencia" name="users" property="use"/>
          <display:column headerClass="headerTable" title="Nombre" class="Numero" >
            <logic:equal  name="users"  property="use" value="S" >
                <html:link paramId="code" paramName="users" paramProperty="code" page="/admin/modifyUser.do">
                  <bean:write name="users" property="name" /> 
                </html:link> 
            </logic:equal>
            <logic:notEqual  name="users" property="use" value="S" >
                <bean:write name="users" property="name" /> 
            </logic:notEqual>      
          </display:column>	
          <display:column headerClass="headerTable" title="Descripcion" class="Numero" >
            <bean:write name="users" property="description" /> 	
          </display:column>	
                    <display:column headerClass="headerTable" title="Secretaria" class="Numero" >
             <bean:write name="users" property="nameArea" /> 	
          </display:column>
          <display:column headerClass="headerTable" title="Grupo de Usuarios" class="Numero" >
             <bean:write name="users" property="userGroupName" /> 	
          </display:column>
          <display:column headerClass="headerTable" title="Vigente" class="Numero" >
             <%
            if(vigencia != null && vigencia.equals("N")){
            %>	
            No
            <% }else{ 
            %>
            Si
            <% }%>
          </display:column>
          <display:column headerClass="headerTable" title="Borrar" class="Numero" media="html">
            <html:link onclick="return confirm('Esta seguro que desea eliminar el usuario?')" paramId="code" paramName="users" paramProperty="code" page="/admin/deleteUser.do">
              <div align="center"><img src="<%= request.getContextPath() + "/images/Delete.gif" %>" width="16" height="16" border="0"></div>
            </html:link>       
          </display:column>	
          
          <display:column headerClass="headerTable" title="Activar" class="Numero" media="html">
          <%
            if(user != null && (user.getUserGroupName().equals("SUPER USUARIO") || user.getUserGroupName().equals("ADMINISTRADOR GENERAL")) && vigencia != null && vigencia.equals("N")){
          %>
            <html:link onclick="return confirm('Esta seguro que desea activar el usuario?')" paramId="code" paramName="users" paramProperty="code" page="/admin/activateUser.do">
              <div align="center"><img src="<%= request.getContextPath() + "/images/activar.gif" %>" width="16" height="16" border="0"></div>
            </html:link>    
           <% } 
           %>
          </display:column>	
          <display:column headerClass="headerTable" title="Desactivar" class="Numero" media="html">
          <%
            if(user != null && (user.getUserGroupName().equals("SUPER USUARIO") || user.getUserGroupName().equals("ADMINISTRADOR GENERAL")) && vigencia != null && vigencia.equals("S")){
          %>
            <html:link onclick="return confirm('Esta seguro que desea desactivar el usuario?')" paramId="code" paramName="users" paramProperty="code" page="/admin/desactivateUser.do">
              <div align="center"><img src="<%= request.getContextPath() + "/images/Delete.gif" %>" width="16" height="16" border="0"></div>
            </html:link>    
           <% } 
           %>
          </display:column>	
        </display:table>
      </logic:present>
      </div>
		</td>
  </tr>
</table>
</body>
</html>